﻿using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows;

namespace Resource.Converter
{
    public class AlertResolvedBtnStringToStyleConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            short? isResolved = (short?)value;
            Style style = new Style();
            if (!isResolved.HasValue)
            {
                return style;
            }
            string btnStyleString = isResolved.Value > 0 ? "Button_Success" : "Button_Danger";
            style = (Style)new FrameworkElement().TryFindResource(btnStyleString);
            return style;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
